<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="com.java.service.*,java.util.*,com.java.model.UserSession,com.java.util.*"%>
<jsp:include page="/jsp/common/header.jsp"></jsp:include>
<body>
<%
	String checkbox[] 		= request.getParameterValues("checkbox");
	String reserve_time		= CmmUtil.nvl(request.getParameter("reserve_time")); 
	String uni_id[] 		= request.getParameterValues("uni_id");
	String dest_phone[] 	= request.getParameterValues("dest_phone");
	String send_phone_num	= CmmUtil.nvl(request.getParameter("send_phone_num"));
	String send_date_act	= CmmUtil.nvl(request.getParameter("send_date_act"));
	String user_id[] 		= request.getParameterValues("user_id");
	String send_text		= CmmUtil.nvl(request.getParameter("send_text"));
	
	String uni_id1[] 		= new String[checkbox.length];
	String dest_phone1[]	= new String[checkbox.length];
	String user_id1[] 		= new String[checkbox.length];
	
	//체크된 항목의 값만  SMS발송을 해주기 위함
	for(int i =0 ; i < checkbox.length; i++){
		uni_id1[i] 			= uni_id[Integer.parseInt(checkbox[i])];
		dest_phone1[i]		= dest_phone[Integer.parseInt(checkbox[i])];
		user_id1[i] 		= user_id[Integer.parseInt(checkbox[i])];
	}
	
	HashMap map = new HashMap();
	HashMap map1 = null;
	ArrayList list = new ArrayList();
	
	CommonDaoService commonservice = new CommonDaoService("ComSmsInsertDao");
	
	map.put("checked_length",checkbox.length);
	map.put("reserve_time",reserve_time);
	map.put("uni_id",uni_id1);
	map.put("dest_phone",dest_phone1);
	map.put("send_phone_num",send_phone_num);
	map.put("send_date_act",send_date_act);
	map.put("user_id",user_id1);
	map.put("send_text",send_text);
	
	list = (ArrayList)commonservice.commonDaoMethod(map);
	
	int sucess = 0;
	if(list != null && list.size() > 0){
		sucess = (Integer)list.get(0);
	}
%>
<script>
	<%if(list != null && list.size() > 0){%>
		alert(<%=sucess%> + " 건의 SMS발송이 성공하였습니다");
		parent.window.close();
	<%}%>
</script>
</body>
</html>